#include"ToolButtonUpDownLock.hpp"
#include <QPainter>
#include <QMouseEvent>
#include <QGridLayout>
#include <QDebug>
#include <QSizePolicy>
using namespace ribbonStyleControls::Controls;
ToolButtonUpDownLock::ToolButtonUpDownLock(QString name, QString iconPath, QWidget* parent)
	:ToolButtonBase(name,iconPath,parent){}

bool ToolButtonUpDownLock::isLocked()
{
	return locked;
}

QRect ToolButtonUpDownLock::iconRect()
{	
	return ToolButtonBase::iconRect();
}

QRect ToolButtonUpDownLock::textRect()
{
	auto rct = rectdown();
	return rct;
}

QRect ToolButtonUpDownLock::arrowRect()
{
	return QRect();
}

QColor ToolButtonUpDownLock::upHover()
{
	if (isPressed) {
		return QColor(221, 226, 230);
	}
	return QColor(232, 235, 239);
}

QColor ToolButtonUpDownLock::downHover()
{
	if (isPressed) {
		return QColor(221, 226, 230);
	}
	return QColor(232, 235, 239);
}

void ToolButtonUpDownLock::mouseReleaseEvent(QMouseEvent* event)
{
	isPressed = false;
	ToolButtonBase::mouseReleaseEvent(event);
}

QRect ToolButtonUpDownLock::fillClickRect()
{
	return rect();
}

void ToolButtonUpDownLock::mousePressEvent(QMouseEvent* event)
{
	isPressed = true;
	locked = !locked;
	ToolButtonBase::mousePressEvent(event);
}
